package com.lantu.com.common.vo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.HashMap;
import java.util.Map;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class Result<T> {
    private  Integer code;
    private  String msg;
    private  String token;
    private  T data;


    public  static <T>  Result<T> success(){
        return  new Result<>(200,"success","",null);
    }
    public  static <T>  Result<T> success(T data){
        return  new Result<>(200,"success","",data);
    }
    public  static <T>  Result<T> success(T data,String msg,String token){
        return  new Result<>(200,msg,token,data);
    }
    public  static <T>  Result<T> success(String msg,String token){
        return  new Result<>(200,msg,token,null);
    }
    public static<T>  Result<T> fail(){
        return new Result<>(201,"fail","",null);
    }

    public static<T>  Result<T> fail(Integer code){
        return new Result<>(code,"fail","",null);
    }

    public static<T>  Result<T> fail(Integer code, String message){
        return new Result<>(code,message,"",null);
    }

    public static<T>  Result<T> fail( String message){
        return new Result<>(201,message,"",null);
    }

}
